<?xml version="1.0" encoding="UTF-8" ?>
<!-- Exempel:
<computer>
  <id>1</id>   
  <title>Javaprogramming</title>
  <authorname>Fredrik</authorname>
  <authorsurname>Alund</authorsurname> 
  <price>23</price>
  <pages>234</pages>
  <description>Bla bla bla</description>
</computer>
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="html"/>

  <xsl:template match="shoppingcart">
  <br />
  <table border="0" cellspacing="0" align = "center">
    <tr bgcolor="silver">
      <td colspan="10">
         <strong>Shoppingcart</strong>
      </td>
    </tr>
    <tr bgcolor="silver">
      <td align="left">Product&#160;&#160;&#160;</td>
      <td align="left">&#160;&#160;&#160;Hard Drive&#160;&#160;&#160;</td>
      <td align="left">&#160;&#160;&#160;Motherboard&#160;&#160;&#160;</td>
      <td align="left">&#160;&#160;&#160;Processor&#160;&#160;&#160;</td>
      <td align="left">&#160;&#160;&#160;RAM&#160;&#160;&#160;</td>
      <td align="left">&#160;&#160;&#160;Videocard&#160;&#160;&#160;</td>
      <td align="left">&#160;&#160;&#160;Quantity&#160;&#160;&#160;</td>
      <td align="left">&#160;&#160;&#160;Price&#160;&#160;&#160;</td>
      <td colspan="2" align="center">Remove</td>
    </tr>
        <xsl:apply-templates/>
    <tr>
      <td colspan="2">
        <a href="shop?action=checkout">Checkout</a>
      </td>
     
    </tr>
   </table>
  </xsl:template>
  
  
  <xsl:template match="order">
  <form method="post" action="shop">
    <tr bgcolor="CornflowerBlue">
        <td>
            computer
        </td>
        <td align="left">&#160;&#160;&#160;<xsl:value-of select="hdd/name"/>&#160;&#160;&#160;</td>
        <td align="left">&#160;&#160;&#160;<xsl:value-of select="motherboard/name"/>&#160;&#160;&#160;</td>
        <td align="left">&#160;&#160;&#160;<xsl:value-of select="processor/name"/>&#160;&#160;&#160;</td>
        <td align="left">&#160;&#160;&#160;<xsl:value-of select="ram/name"/>&#160;&#160;&#160;</td>
        <td align="left">&#160;&#160;&#160;<xsl:value-of select="videocard/name"/>&#160;&#160;&#160;</td>
        
        <td align="right">
            <xsl:element name="input"> <!--A ordinary input in XSLT-->
              <xsl:attribute name="size">2</xsl:attribute>
              <xsl:attribute name="type">text</xsl:attribute>
              <xsl:attribute name="value"><xsl:value-of select="quantity"/></xsl:attribute>
              <xsl:attribute name="name">quantity</xsl:attribute>
            </xsl:element>        
        </td>
        <td align="left">&#160;&#160;&#160;<xsl:value-of select="(hdd/price+motherboard/price+processor/price+ram/price+videocard/price)*quantity"/>&#160;&#160;&#160;</td>
        <td>
            <input type="submit" value="Remove"/>
        </td>
    
      <xsl:element name="input"> <!--A ordinary input in XSLT-->
        <xsl:attribute name="type">hidden</xsl:attribute>
        <xsl:attribute name="value"><xsl:value-of select="hdd/id"/></xsl:attribute>
        <xsl:attribute name="name">hdd_id</xsl:attribute>
      </xsl:element>
      <xsl:element name="input"> <!--A ordinary input in XSLT-->
        <xsl:attribute name="type">hidden</xsl:attribute>
        <xsl:attribute name="value"><xsl:value-of select="motherboard/id"/></xsl:attribute>
        <xsl:attribute name="name">mb_id</xsl:attribute>
      </xsl:element>
      <xsl:element name="input"> <!--A ordinary input in XSLT-->
        <xsl:attribute name="type">hidden</xsl:attribute>
        <xsl:attribute name="value"><xsl:value-of select="processor/id"/></xsl:attribute>
        <xsl:attribute name="name">proc_id</xsl:attribute>
      </xsl:element>
      <xsl:element name="input"> <!--A ordinary input in XSLT-->
        <xsl:attribute name="type">hidden</xsl:attribute>
        <xsl:attribute name="value"><xsl:value-of select="ram/id"/></xsl:attribute>
        <xsl:attribute name="name">ram_id</xsl:attribute>
      </xsl:element>
      <xsl:element name="input"> <!--A ordinary input in XSLT-->
        <xsl:attribute name="type">hidden</xsl:attribute>
        <xsl:attribute name="value"><xsl:value-of select="videocard/id"/></xsl:attribute>
        <xsl:attribute name="name">vc_id</xsl:attribute>
      </xsl:element>
      <xsl:element name="input"> <!--A ordinary input in XSLT-->
        <xsl:attribute name="type">hidden</xsl:attribute>
        <xsl:attribute name="value">remove</xsl:attribute>
        <xsl:attribute name="name">action</xsl:attribute>
      </xsl:element>

    </tr>
    </form>
  </xsl:template>

  
</xsl:stylesheet>
